﻿/// <reference path="/Scripts/Helpers/Functions.js" />
/// <reference path="/Scripts/jquery-1.7.2.js" />
/// <reference path="/Scripts/jquery.mobile-1.1.0.js" />

// namespace Monter_Palette [Preparation]
var Monter_Palette = (function()
{
    var my = {},
    _currentStep = 0;

    my.loaded = function()
    {
        initEvents();
    };

    // INITIALISE LES EVENEMENTS DE LA PAGE
    function initEvents()
    {
        // ÉVÈNEMENT : APPUI SUR LE BOUTON RETOUR
        $("#btn_retour").click(function()
        {
            switch (_currentStep)
            {
                case 0:
                    {
                        window.location = "/Accueil";
                        break;
                    }
                case 1:
                    {
                        $("#title").text("Scannez une marchandise");
                        $("#icone_marchandise").css("display", "inline");
                        $("#icone_emplacement").css("display", "none");
                        break;
                    }
            }
            _currentStep--;

        });

        // ÉVÈNEMENT : APPUI SUR LE BOUTON SCANNER
        $("#btn_scanner").click(function()
        {
            switch (_currentStep)
            {
                case 0:
                    {
                        $("#title").text("Scannez un emplacement");
                        $("#icone_emplacement").css("display", "inline");
                        $("#icone_marchandise").css("display", "none");
                        break;
                    }
                case 1:
                    {
                        $("#title").text("Marchandise enregistrée");
                        $("#icone_ok").css("display", "inline");
                        $("#icone_emplacement").css("display", "none");
                        $("#btn_ok").css("display", "inline");
                        $("#btn_scanner").css("display", "none");
                        $("#btn_retour").css("visibility", "collapse");
                        break;
                    }
            }
            _currentStep++;
        });

        $("#btn_ok").click(function()
        {
            window.location = "/Reception/Enregistrer";
        });
    }

    return my;
} ());

Functions.addLoadListener(Monter_Palette.loaded);

$(document).bind("mobileinit", function()
{
    //apply overrides here
    $.mobile.defaultPageTransition = "flow";
});